package MEET.src.code;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/MeetingDetailServlet")
public class MeetingDetailServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String meetingId = request.getParameter("meetingId");
        MeetingController controller = new MeetingController();
        Meeting meeting = controller.getMeetingDetails(meetingId);

        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();

        if (meeting != null) {
            out.println("<p><strong>会议号：</strong> " + meeting.getMID() + "</p >");
            out.println("<p><strong>会议名称：</strong> " + meeting.getMname() + "</p >");
            out.println("<p><strong>主持人：</strong> " + meeting.getName() + "</p >");
            out.println("<p><strong>会议时间：</strong> " + meeting.getMstarttime() + "</p >");
            out.println("<p><strong>会议时间：</strong> " + meeting.getMendtime() + "</p >");
            out.println("<p><strong>校区：</strong> " + meeting.getPlace() + "</p >");
            out.println("<p><strong>具体位置：</strong> " + meeting.getLocation() + "</p >");
            out.println("<p><strong>房间号：</strong> " + meeting.getRoom() + "</p >");
            out.println("<p><strong>会议形式：</strong> " + meeting.getForm() + "</p >");
            out.println("<p><strong>会议类型：</strong> " + meeting.getType() + "</p >");
            out.println("<p><strong>状态：</strong> " + meeting.getStatus() + "</p >");
        } else {
            out.println("<p>未找到会议信息</p >");
        }
    }
}